#ifndef _PACKER_H_
#define _PACKER_H_


/*
	class : Packer
	desc : This class is used to pack data
		into a series of buffers using
		the smallest amount of space possible.
		This is useful for dealing with protocols
		that require packing bits into a specific
		order or have a special order for packing
		data that isn't obvious at the get go.
*/
class Packer
{
	private:
		//holds data that has just been packed
		Queue<unsigned char> packedData;
		//contains data that is currently being packed.
		unsigned char package;
		//tells which bit has yet to be packed in there
		unsigned char currentUnpackedBit;
		//tells the total number of bits that have been packed.
		unsigned long int totalPackedBits;
	public:
		//default constructor for packer object.
		Packer();
		//returns if the packer is empty
		//always check this first before using get.
		bool empty();
		//tells the packer that you are done packing data
		//finishes packing the remainder of the data
		void finish();
		//packages the bit array 
		void pack(BitArray array);
		//gets packed data from the packer and puts the packed
		//count into the packedCount reference and returns
		//the data that is packed. It is aligned at the zero
		//index. When using be sure to shift Right when emptying.
		unsigned char get(unsigned char& packedCount);
};


#endif
